/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pojo;

import com.mysql.jdbc.MySQLConnection;
import java.sql.ResultSet;
import util.MySQLDataAccessHelper;

/**
 *
 * @author Rocker000
 */
public class SanPham_pojo {
    private String ChiTietSanPham;
    private String MaSanPham;
    private String MaLoai;
    private String TenSanPham;
    private String Hieu;
    private String Image;
    private double Gia;
    private int SoLuongTon;
    private int SoLuotMua;
    private float KichThuoc;

    public String getMaLoai() {
        return MaLoai;
    }

    public void setMaLoai(String MaLoai) {
        this.MaLoai = MaLoai;
    }

    
    public String getChiTietSanPham() {
        return ChiTietSanPham;
    }

    public void setChiTietSanPham(String ChiTietSanPham) {
        this.ChiTietSanPham = ChiTietSanPham;
    }
    

    public SanPham_pojo() {
    }

    public double getGia() {
        return Gia;
    }

    public void setGia(double Gia) {
        this.Gia = Gia;
    }

    public String getHieu() {
        return Hieu;
    }

    public void setHieu(String Hieu) {
        this.Hieu = Hieu;
    }

    public String getImage() {
        return Image;
    }

    public void setImage(String Image) {
        this.Image = Image;
    }

    public float getKichThuoc() {
        return KichThuoc;
    }

    public void setKichThuoc(float KichThuoc) {
        this.KichThuoc = KichThuoc;
    }

    public String getMaSanPham() {
        return MaSanPham;
    }

    public void setMaSanPham(String MaSanPham) {
        this.MaSanPham = MaSanPham;
    }

    public int getSoLuongTon() {
        return SoLuongTon;
    }

    public void setSoLuongTon(int SoLuongTon) {
        this.SoLuongTon = SoLuongTon;
    }

    public int getSoLuotMua() {
        return SoLuotMua;
    }

    public void setSoLuotMua(int SoLuotMua) {
        this.SoLuotMua = SoLuotMua;
    }

    public String getTenSanPham() {
        return TenSanPham;
    }

    public void setTenSanPham(String TenSanPham) {
        this.TenSanPham = TenSanPham;
    }

    public SanPham_pojo(String ChiTietSanPham, String MaSanPham, String MaLoai, String TenSanPham, String Hieu, String Image, double Gia, int SoLuongTon, int SoLuotMua, float KichThuoc) {
        this.ChiTietSanPham = ChiTietSanPham;
        this.MaSanPham = MaSanPham;
        this.MaLoai = MaLoai;
        this.TenSanPham = TenSanPham;
        this.Hieu = Hieu;
        this.Image = Image;
        this.Gia = Gia;
        this.SoLuongTon = SoLuongTon;
        this.SoLuotMua = SoLuotMua;
        this.KichThuoc = KichThuoc;
    }
    public String getMaDanhMuc()
    {
        String sql ="select madanhmuc from danhmuc,sanpham,loaisanpham where loaisanpham.maloaisanpham='"+this.MaLoai+"'and loaisanpham.madanhmuc = danhmuc.madanhmuc";
        String madanhmuc=null;
        try
        {
            MySQLDataAccessHelper helper = new MySQLDataAccessHelper();
            helper.Open();
            ResultSet rs = helper.ExeCuteQuery(sql);
            if(rs.next())
                madanhmuc = rs.getString("madanhmuc");
            helper.Close();
        }
        catch(Exception ex)
        {}
        return madanhmuc;
    }
    
    
}
